<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="one">
        
    </div>

    <button id="doGet">doGet</button>
    <button id="doPost">doPost</button>

    <script src="https://code.jquery.com/jquery-3.6.1.min.js"></script>
    <script>
        let doGetBtn = document.querySelector('#doGet');        
        doGetBtn.onclick = function() {
            $.ajax({
                type: 'get',
                url: 'hello',
                success: function(body) {
                    let div = document.querySelector('.one');
                    div.innerHTML = body;
                }
            });
        }

        let doPostBtn = document.querySelector('#doPost');
        doPostBtn.onclick = function() {
            $.ajax({
                type: 'post',
                url: '/servlet/hello',
                success: function(body) {
                    // console.log(body);  
                    let div = document.querySelector('.one');
                    div.innerHTML = body;
                }
            });
        }
    </script>
</body>
</html>